<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
        }

        .box {
            width: 200px;
            margin: 0 auto;
        }

        header {
            box-sizing: border-box;
            padding: 20px;
            background-color: #000;
            color: #fff;
            line-height: 20px;
        }

        ul {
            display: none;
        }

        li {
            box-sizing: border-box;
            padding: 20px;
            background-color: #ccc;
            color: #000;
            line-height: 20px;
        }

        .bb {
            color: #fff;
            background-color: #000;
        }
    </style>
</head>

<body>
    <div class="box">
        <header>播放列表</header>

        <ul>
            <li>11111111</li>
            <li>2222222222</li>
            <li>33333333333</li>
            <li>44444444</li>
            <li class="aa">点击关闭</li>
        </ul>
    </div>
</body>
<script>
    var header = document.querySelector('header')

    var ul = document.querySelector('ul')

    var li = document.querySelectorAll('li')

    var aa = document.querySelector('.aa')

    header.onclick = function () {
        if (ul.style.display != 'none') {
            ul.style.display = 'block'
        } else {
            ul.style.display = 'none'
        }
    }

    for (var i = 0; i < li.length; i++) {
        li[i].index = i
        li[i].onmouseover = function () {
            // this.style.background = '#000'
            // this.style.color = '#fff'
            this.className = 'bb'
        }

        // li[i].onmouseover = function () {
        //     this.style.background = ''
        //     this.style.color = ''
        // }

        li[i].onmouseout = function () {
            // this.style.background = '#000'
            // this.style.color = '#fff'
            this.className = ''
        }
    }




    aa.onclick = function () {
        ul.style.display = 'none'
    }

</script>

</html>